package com.cobra.activiti.response;

/**
 * @author yaobin
 * @date 2019/11/26 0022 9:59
 * @Description 返回响应对象工具类
 */
public class ResultVOUtil {

    /**
     * 成功
     *
     * @param object
     * @return
     */
    public static ReturnValueLoader success(Object object) {
        ReturnValueLoader resultVO = new ReturnValueLoader();
        resultVO.setCode(ResultCode.SUCCESS.getCode());
        resultVO.setMsg(ResultCode.SUCCESS.getMsg());
        resultVO.setData(object);
        return resultVO;
    }

    /**
     * @return
     */
    public static ReturnValueLoader success() {
        return success(null);
    }

    /**
     * 失败
     *
     * @param data
     * @return
     */
    public static ReturnValueLoader error(Object data) {
        ReturnValueLoader resultVO = new ReturnValueLoader();
        resultVO.setCode(ResultCode.ERROR.getCode());
        resultVO.setMsg(ResultCode.ERROR.getMsg());
        resultVO.setData(data);
        return resultVO;
    }

}
